package fr.insta.browser.view.frame;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.border.EmptyBorder;

import fr.insta.browser.home.SetUpHomePanel;

/**
 * <p>ToolsFrame class.</p>
 *
 * @author Maarek
 * @version $Id: $Id
 */
public class ToolsFrame extends JFrame
{
	private JPanel contentPane;
	private MainFrame parentWindow;

	/**
	 * Create the frame.
	 *
	 * @param parent a {@link javax.swing.JFrame} object.
	 */
	public ToolsFrame(MainFrame parent) {

		this.parentWindow = parent;
		init_components();

		JTabbedPane ongletsPref = new JTabbedPane(JTabbedPane.TOP);
		ongletsPref.setBounds(0, 0, 652, 320);
		contentPane.add(ongletsPref);

		JPanel homePanel = new SetUpHomePanel(this, parentWindow.getTabService());
		ongletsPref.add(homePanel);
		ongletsPref.setTitleAt(0, "Page d'accueil");
		
		JPanel privateHistoryPanel = new HistoryPanel(this);
		ongletsPref.add(privateHistoryPanel);
		ongletsPref.setTitleAt(1, "Historique");

		this.setVisible(true);
		
	}

	/**
	 * <p>init_components.</p>
	 */
	public void init_components()
	{
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setLocationRelativeTo(parentWindow);
		setBounds(100, 100, 660, 350);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		setResizable(false);
		contentPane.setLayout(null);
	}

	/**
	 * <p>Getter for the field <code>parentWindow</code>.</p>
	 *
	 * @return a {@link javax.swing.JFrame} object.
	 */
	public MainFrame getParentWindow()
	{
		return parentWindow;
	}
	}
